//方法1   利用Set进行数组去重
const arr = ['张三','张三','三张三']
let set = new Set(arr); // set 自带去重
console.log(set);


//方法二 利用indexOf去重    
var arr2 = [ 1, 2, 1, 3, 2, 6 , 9, 5 ,3];
function noRepeat1(arr) {
    var newArr = [];
    for (var i = 0; i < arr2.length; i++) {
        if (newArr.indexOf(arr2[i]) == -1) {
            newArr.push(arr2[i]);
        }
    }
    return newArr;
}
var result2 = noRepeat1(arr2);
console.log(result2);